
/********************************************************************************
Documentation file for stata do-files and datasets corresponding to the paper titled: "Corruption in Cyclone Relief and Reconstruction: Evidence from a Public Fund Distribution in Bangladesh"
By Shaikh Eskander, Asad Islam, and Mustafa Kamal 

September 28, 2025

********************************************************************************/


use data.dta, clear  
	
	
// Figure 1: Missing grant at the village level.
	preserve 

	gen grantmissP=grantmiss/1000
	egen n1=count(vill),by(vill)
	egen n2=sum(grantmiss1),by(vill)
	egen n3=sum(grant),by(vill) 
	egen n4=sum(grantmissP),by(vill)
		gen p1=100*n2/n1 // % of households with missing grant 
		gen p2=100*(n1-n3)/n1 // % of households receiving no grant 
		gen p3=n4/n3 // average amount of missing grant 
		gen p4=n4 // total amount of missing grant
	duplicates drop vill, force
	keep vill p1 p2 p3 p4 
	
	// A. % of households with missing grant 
	gsort -p1
	gen n=_n
	twoway (bar p1 n, sort), name(fig1a, replace) ///
		title(A. % of households with missing grant, size(medium) lc(dknavy)) ///
		graphregion(fcolor(white) lcolor(white)) ///
		scheme(s1color) ysize(4) xsize(7) ///
		ytitle(% of households, size(medium) height(5)) xlab() ///
		xtitle(No. of villages, size(medium)) ///
		ylab(0(20)60, angle(horizontal) labsize(medsmall)) 
	drop n 
	
	// B. % of households receiving no grant 
	gsort -p2
	gen n=_n
	twoway (bar p2 n, sort), name(fig1b, replace) ///
		title(B. % of households receiving no grant, size(medium) lc(dknavy)) ///
		graphregion(fcolor(white) lcolor(white)) ///
		scheme(s1color) ysize(4) xsize(7) ///
		ytitle(% of households, size(medium) height(5)) xlab() ///
		xtitle(No. of villages, size(medium)) ///
		ylab(0(20)100, angle(horizontal) labsize(medsmall)) 
	drop n 
	
	// C. Average amount of missing grant 
	replace p3=0 if p3==.
	gsort -p3
	gen n=_n
	twoway (bar p3 n, sort), name(fig1c, replace) ///
		title(C. Average amount of missing grant, size(medium) lc(dknavy)) ///
		graphregion(fcolor(white) lcolor(white)) ///
		scheme(s1color) ysize(4) xsize(7) ///
		ytitle('000 taka, size(medium) height(5)) xlab() ///
		xtitle(No. of villages, size(medium)) ///
		ylab(0(1)4, angle(horizontal) labsize(medsmall)) 
	drop n 
	
	// D. Total amount of missing grant
	gsort -p4
	gen n=_n
	twoway (bar p4 n, sort), name(fig1d, replace) ///
		title(D. Total amount of missing grant, size(medium) lc(dknavy)) ///
		graphregion(fcolor(white) lcolor(white)) ///
		scheme(s1color) ysize(4) xsize(7) ///
		ytitle('000 taka, size(medium) height(5)) xlab() ///
		xtitle(No. of villages, size(medium)) ///
		ylab(0(20)80, angle(horizontal) labsize(medsmall)) 
	drop n 
	
	graph combine fig1a fig1b fig1c fig1d, c(2) ///
		graphregion(color(white)) name(Fig1, replace)
	graph export Figure-1.png, as(png) replace
	
	restore

	
	
// Table A1. Summary of statistics of variables 
	global x8 damage DIR age sex edu hhsize income ///
		enlist grant grantmiss grantmiss1 bribe bribeamt ///
		risk network12 network10 Dnetwork
		
	quietly outreg2 using tabA1.doc, replace ///
		sum(log) keep($x8) dec(3) ///
		stat(N mean sd min max) ///
		title(Table A1. Summary of statistics of variables) 
		
		
// Figure S1. kernel density plot for change in political network 
	kdensity Dnetwork, name(figS1, replace) ///
		graphregion(fcolor(white) lcolor(white)) ///
		scheme(s1color) ysize(4) xsize(7) ///
		ytitle(Density, size(medium) height(5)) xlab() ///
		xtitle(Change in political network, size(medium)) ///
		ylab(0(0.5)2, angle(horizontal) labsize(medsmall)) 
		
	graph export Figure-S1.png, as(png) replace 
	
	
// Table A2. Components of network  
	preserve 
	
	merge 1:1 hhid using data_sup

	global x1 	net1_10 net2_10 net3_10 net4_10 net5_10 net6_10 ///
				net1_12 net2_12 net3_12 net4_12 net5_12 net6_12 /// 
				risk network12 network10 Dnetwork
				
	outreg2 using tabA2.doc, replace ///
		sum(log) keep($x1) dec(3) ///
		stat(N mean sd min max) ///
		title(Table A2. Components of network) 
	desc $x1
	
	restore



// Table 1. Networks and corruption
	ihstrans income bribeamt grantmiss
	global X Dnetwork DIR sex ihs_income
	global Z risk edu network10
	
	// (A) OLS results
	// Enlistment
	quietly reghdfe enlist $X, abs(vill) vce(robust)
	outreg2 using tab01A.doc, replace dec(3) ///
		ctitle(Enlistment) ///
		title((A) OLS results)
	// Bribe
	quietly reghdfe ihs_bribeamt $X, abs(vill) vce(robust)
	outreg2 using tab01A.doc, append dec(3) ///
		ctitle(Bribe)
	// Grant receipt 
	quietly reghdfe grant $X if enlist==1, abs(vill) vce(robust)
	outreg2 using tab01A.doc, append dec(3) ///
		ctitle(Receipt)
	// Missing grant
	quietly reghdfe ihs_grantmiss $X if grant==1, abs(vill) vce(robust)
	outreg2 using tab01A.doc, append dec(3) ///
		ctitle(Missing grant)

	// (B) 2SLS results
	// Enlistment
	quietly ivreghdfe enlist (Dnetwork=$Z) $X, first abs(vill) vce(robust)
	outreg2 using tab01B.doc, replace ///
		drop(i.vill) dec(3) e(sarganp) ctitle(Enlistment) ///
		title((B) 2SLS results)
	// Bribe
	quietly ivreghdfe ihs_bribeamt (Dnetwork=$Z) $X, first abs(vill) vce(robust)
	outreg2 using tab01B.doc, append dec(3) e(sarganp) ///
		ctitle(Bribe)
	// Grant receipt 
	quietly ivreghdfe grant (Dnetwork=$Z) $X, first abs(vill) vce(robust)
	outreg2 using tab01B.doc, append dec(3) e(sarganp) ///
		ctitle(Receipt)
	// Missing grant
	quietly ivreghdfe ihs_grantmiss (Dnetwork=$Z) $X, first abs(vill) vce(robust)
	outreg2 using tab01B.doc, append dec(3) e(sarganp) ///
		ctitle(Missing grant)

	// Table S1. Endogenous network formation 
		quietly reg Dnetwork $Z
		outreg2 using tabS1.doc, replace ///
			dec(3) title(Table S1. Endogenous network formation)
	
	// (C) 3SLS results
	// Probability of enlistment
	quietly reg3 (enlist=$X i.vill) (Dnetwork=$Z), sure
	outreg2 using tab01C.doc, replace ///
		drop(i.vill) dec(3) ctitle(Enlistment) ///
		title((C) 3SLS results)
	// Amount of bribe
	quietly reg3 (ihs_bribeamt=$X i.vill) (Dnetwork=$Z), sure
	outreg2 using tab01C.doc, append ///
		drop(i.vill) dec(3) ctitle(Bribe)
	// Probability of receipt 
	quietly reg3 (grant=$X i.vill) (Dnetwork=$Z) if enlist==1, sure
	outreg2 using tab01C.doc, append ///
		drop(i.vill) dec(3) ctitle(Receipt)
	// Amount of missing grant
	quietly reg3 (ihs_grantmiss=$X i.vill) (Dnetwork=$Z) if grant==1, sure
	outreg2 using tab01C.doc, append ///
		drop(i.vill) dec(3) ctitle(Missing grant)

		
		

// Table 2. Total bribes and missing grants
	preserve
	
	gen grantmissP=grantmiss/1000
	gen bribeamtP=bribeamt/1000

	global x10 enlist grant grantmissP grantmiss1 bribe bribeamtP 
	quietly outreg2 using tab02.doc, replace ///
		sum(log) keep($x10) dec(3) stat(N mean sd min max) ///
		title(Table 2. Total bribes and missing grants) 

	tab bribe if grant==1 // % of grant recipient households who paid a bribe 
	tab bribe if enlist==1 // % of enlisted households who paid a bribe 
	sum bribeamtP if bribeamtP>0 // avg bribe amount for those who paid a bribe
	sum bribeamtP if grant==1 // avg bribe amount for those who received the grant
	
		gen grantmissP2=grantmissP
		replace grantmissP2=20 if grantmissP==. & enlist==1 & grant==0
		sum grantmissP2 // avg missing grant for all enlisted households 
		
	gen tmissing=bribeamtP+grantmissP2
	sum tmissing // avg bribes plus missing grant for all grant recipient
	
		gen bribepc=100*bribeamtP/20
		gen tbribepc=100*tmissing/20
		sum bribepc tbribepc // bribes and bribes plus missing grant as % of total grant
		
	tab grant if enlist==1 & grant==0 // No. of enlisted households who didn't receive the grant 
		egen Tmiss=sum(grantmissP2) // grand total of missing grant 
		egen Tbribe=sum(bribeamtP) // grand total of bribe
		gen TotalMissing=Tmiss+Tbribe // grand total of bribe plus missing grant 
		
	gen Tmisspc=100*Tmiss/(20*1113) // grand total of missing grant as % of grand total grant 
	gen TotalMissingpc=100*TotalMissing/(20*1113) // grand total of bribe plus missing grant as % of grand total grant 

	global x11 tmissing bribepc tbribepc Tmiss Tbribe TotalMissing Tmisspc TotalMissingpc
	sum $x11 if enlist==1
	outreg2 using tab02.doc, append ///
		sum(log) keep($x11) dec(3) stat(N mean sd min max) 
		
	restore 
